package com.lambdademo.stream.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 作者类
 * @since  2024/09/05
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode// 重写equals和hashCode方法
public class Author implements Comparable<Author>{
    private Long id;
    private String name;
    private Integer age;
    //简介
    private String intro;
    //作者所写的书籍列表
    private List<Book> books;

    @Override
    public int compareTo(Author o) {
        return this.age - o.age;
    }
}
